home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / AMOSPRO4.DMS / in.adf / Tutorials / Menus / Menus_2.AMOS / Menus_2.amosSourceCode
Encoding:
AMOS Source Code  |  1992-09-28  |  2.4 KB  |  76 lines

  1. '*************************** 
  2. '*    AMOS Professional    * 
  3. '*                         * 
  4. '*         MENUS 2         * 
  5. '*                         *           Menu structures and hierarchy 
  6. '* (c) Europress Software  * 
  7. '*                         * 
  8. '*     Ronnie Simpson      * 
  9. '*************************** 
  10. '
  11. '------------------------------------------- 
  12. 'SETTING UP SUB-OPTIONS
  13. '------------------------------------------- 
  14. 'In the first tutorial a simple menu was created with the commands 
  15. '
  16. '
  17. '              Menu$(3)="COLOUR"   (title) 
  18. '              Menu$(3,1)="RED"    (first option)
  19. '              Menu$(3,2)="GREEN"  (second option) 
  20. '              etc...etc.... 
  21. '
  22. 'Sub options are generated (in a similar manner to arrays) by expanding  
  23. 'the number of parameters given:-  
  24. '
  25. '              Menu$(3,1,1)="LIGHT"  
  26. '              Menu$(3,1,2)="DARK" 
  27. '              Menu$(3,2,1)="LIGHT"  
  28. '              Menu$(3,2,2)="DARK" 
  29. '              etc...etc.... 
  30. '
  31. 'Each level is represented by its separate element and each is controlled
  32. 'with its own Menu$ instruction. 
  33. '
  34. 'Up to a maximum of 8 levels can be generated. 
  35. '
  36. '
  37. '------------------------------------------- 
  38. 'WORKING EXAMPLE 
  39. '------------------------------------------- 
  40. Rem *** tidy up the screen 
  41. '
  42. Screen Open 0,640,200,16,Hires
  43. Palette $0,$F00,$F0,$F,$DAF,$F0F,$FF,$F70,$7F,$70F,$F07,$333,$666,$999,$CCC,$FFF
  44. Flash Off : Curs Off : Cls 0 : Pen 7 : Paper 0
  45. '
  46. Rem *** set up a large menu  
  47. '
  48. Pen 4 : Locate 0,9 : Cline : Centre "PLEASE WAIT WHILE I SET UP A LARGE MENU......."
  49. For TITLE=1 To 5
  50.    Menu$(TITLE)="TITLE"+Str$(TITLE)+"  "
  51.    For OPTION=1 To 10
  52.       Menu$(TITLE,OPTION)="OPTION"+Str$(OPTION)
  53.       For SUB1=1 To 5
  54.          Menu$(TITLE,OPTION,SUB1)="SUB OPTION A"+Str$(SUB1)
  55.          For SUB2=1 To 3
  56.             Menu$(TITLE,OPTION,SUB1,SUB2)="SUB OPTION B"+Str$(SUB2)
  57.          Next 
  58.       Next 
  59.    Next 
  60. Next 
  61. Menu On 
  62. '
  63. Pen 1 : Locate 0,23 : Centre "PRESS LEFT MOUSE KEY TO QUIT"
  64. Pen 4 : Locate 0,9 : Cline : Centre "PRESS RIGHT MOUSE KEY TO SEE MENU"
  65. '
  66. Rem *** start the main loop  
  67. '
  68. Do 
  69.    Repeat : M=Mouse Key : Until M>0
  70.    If M=1 Then Edit 
  71.    While Choice : Wend 
  72.    Pen 6 : Locate 0,14 : Centre "To read this menu and cover every eventuality would require"
  73.    Locate 0,15 : Centre "an enormous amount of if....then tests, the next program in the"
  74.    Locate 0,16 : Centre "series deals with easier ways of reading menus automatically."
  75. Loop 
  76. Wait Key